<?php
error_reporting(0);
$q=$_GET["q"];
$pdo=new PDO('mysql:host=localhost;dbname=db_pet','root','root');
		$sql1="select email from projector";
		$sql2="select email from doctor";
		$sql3="select email from worker";
		$sql4="select email from administrator";
		$stmt1=$pdo->prepare($sql1);
		$stmt2=$pdo->prepare($sql2);
		$stmt3=$pdo->prepare($sql3);
		$stmt4=$pdo->prepare($sql4);
		$stmt1->execute();
		$stmt2->execute();
		$stmt3->execute();
		$stmt4->execute();
		while($row1=$stmt1->fetch()){
			$mail[]=$row1['email'];
		}
		while($row2=$stmt2->fetch()){
			$mail[]=$row2['email'];
		}
		while($row3=$stmt3->fetch()){
			$mail[]=$row3['email'];
		}
		while($row4=$stmt4->fetch()){
			$mail[]=$row4['email'];
		}
if(!in_array($q,$mail)){
	$response="该邮箱未被注册";
}else{
	$pdo=new PDO('mysql:host=localhost;dbname=db_pet','root','root');
	$sql1="select * from projector where email=?";
	$stmt1=$pdo->prepare($sql1);
	$stmt1->execute(array($q));
	while($row1 = $stmt1->fetch()){
		$username1=$row1['username'];
		$password=base64_decode($row1['password']);
		$response="用户名:".$username1." 密码:".$password;
	}

	$sql2="select * from ,doctor where email=?";
	$stmt2=$pdo->prepare($sql2);
	$stmt2->execute(array($q));

	while($row2 = $stmt2->fetch()){
		$username2=$row2['username'];
		$password2=base64_decode($row2['password']);
		$response="用户名:".$username2." 密码:".$password2;
	}


	$sql3="select * from worker where email=?";
	$stmt3=$pdo->prepare($sql3);
	$stmt3->execute(array($q));

	while($row3 = $stmt3->fetch()){
		$username3=$row3['username'];
		$password3=base64_decode($row3['password']);
		$response="用户名:".$username3." 密码:".$password3;
	}

	$sql4="select * from administrator where email=?";
	$stmt4=$pdo->prepare($sql4);
	$stmt4->execute(array($q));

	while($row4 = $stmt4->fetch()){
		$username4=$row4['username'];
		$password4=base64_decode($row4['password']);
		$response="用户名:".$username4." 密码:".$password4;
	}

}
echo $response;
?>






